package com.yiyang.controller;

import com.yiyang.domain.Result;
import com.yiyang.domain.po.Room;
import com.yiyang.domain.vo.RoomVo;
import com.yiyang.service.RoomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/rooms")
public class RoomController {
    @Autowired
    RoomService roomService;

    @GetMapping("/listRoom")
    public Result<List<Room>> listRoom(){
        return Result.success(roomService.list());
    }

    @GetMapping("/findCwsyBedVo")
    public Result<RoomVo> findCwsyBedVo(String floor){
        RoomVo roomVo =  roomService.findCwsyBedVo(floor);

        return Result.success(roomVo);
    }
}
